#!/user/bin/python
#coding = utf-8


import sys 
number = 1
min = 2
for line in sys.stdin:
    words = line.strip('\n').split('\t')
    key = words[0]
    value = int(words[1])
    if number == 1:
        products = key
        frequence = value 
        number += 1
        continue
    elif key == products:
        frequence += 1
    else: 
        if frequence >= min: 
            print(str(frequence)+'\t'+products)
        products = key
        frequence = value
if frequence >= min:
    print(str(frequence)+'\t'+products)
        